#include "CommonDepence.h"
COLORREF Randomize() {
	return RGB(rand(), rand(), rand());
};
COLORREF BWRandomize() {
	int x = rand()%256;
	return RGB(x, x, x);
}
COLORREF BWEmpty() {
	return RGB(0, 0, 0);
}
COLORREF BWEmpty_LeftTopW(int x,int y,int width,int height)
{
	if (x == 0 || y == 0) {
		return RGB(0xff, 0xff, 0xff);
	}
	else {
		return RGB(0, 0, 0);
	}
}

COLORREF Empty_LeftTopR_RightBottomB(int x, int y,int width,int height)
{
	if (x == 0 || y == 0) {
		return RGB(0xff, 0, 0);
	}
	else if(x==width-1||y==height-1) {
		return RGB(0, 0, 0xff);
	}
	else {
		return RGB(0, 0, 0);
	}
}

void colorTOdata(COLORREF* src, char* des, int pixelLength)
{
	for (int i = 0; i < pixelLength; i++) {
		char r = GetRValue(src[i]);
		char g = GetGValue(src[i]);
		char b = GetBValue(src[i]);
		des[i] = r;
		des[i + pixelLength] = g;
		des[i + 2 * pixelLength] = b;
	}

}

void dataTOcolor(char* src, COLORREF* des, int pixelLength)
{
	for (int i = 0; i < pixelLength; i++) {
		des[i] = RGB(src[i], src[i + pixelLength], src[i + 2 * pixelLength]);
	}
}
